#include "Defines.h"
#include <sstream>

std::ostream& operator<<( std::ostream& os, const Rect& rect)
{
	os << "X: " << rect.x << " \t\tY: " << rect.y << std::endl
	   << "Width: " << rect.w << " \tHeight: " << rect.h;

   return os;
}

std::stringstream& operator<<( std::stringstream& ss, const Rect& rect )
{
	ss << "X: " << rect.x << " \t\tY: " << rect.y << std::endl
		<< "Width: " << rect.w << " \tHeight: " << rect.h;

	return ss;
}

sf::Vector2f GetIsoHotspot( const sf::Vector2f& pos, const sf::Vector2i& size )
{
	sf::Vector2f temp = pos;
	temp.x += size.x/2;
	temp.y += size.y;

	return temp;
}

bool IsCollision( const Rect& first, const Rect& second )
{
	return (    first.x < second.x + second.w &&
				first.x + first.w > second.x  &&
				first.y < second.y + second.h &&
				first.y + first.h > second.y         
			);	
}
Rect::operator sf::IntRect() const
{
	sf::IntRect temp; 

	temp.Left = x; temp.Top = y;
	temp.Right = x+w; temp.Bottom = y+h; 
	
	return temp;
}
